<template>
	<view class="page">
		<xzfx-panel v-if="form" title="求购人信息" isCard>
			<view class="xzfx-form" slot="content">
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">求购人</view>
					<view class="xzfx-form-value">{{ form.contackName || "" }}</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">联系电话</view>
					<view class="xzfx-form-value">{{ form.contackPhone | _maskPhone }}</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">期望交易地</view>
					<view class="xzfx-form-value">{{ form.province || "" }}{{ form.city || "" }}{{ form.district || "" }}</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">详细地址</view>
					<view class="xzfx-form-value">{{ form.location || "" }}</view>
				</view>
			</view>
		</xzfx-panel>
		<xzfx-panel v-if="form" title="意向车辆信息" isCard>
			<view class="xzfx-form" slot="content">
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">品牌</view>
					<view class="xzfx-form-value">{{ form.truckBrand || "" }}</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">车型</view>
					<view class="xzfx-form-value">{{ form.truckType || "" }}</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">开始年份</view>
					<view class="xzfx-form-value">{{ form.productYearStart || "" }}年</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">结束年份</view>
					<view class="xzfx-form-value">{{ form.productYearEnd || "" }}年</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">最大马力</view>
					<view class="xzfx-form-value">{{ form.maxPower || "" }}匹以上</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">求购数量</view>
					<view class="xzfx-form-value">{{ form.num || "" }}辆</view>
				</view>
				<view class="xzfx-form-item">
					<view class="xzfx-form-label">其他要求</view>
					<view class="xzfx-form-value">{{ form.remark || "" }}</view>
				</view>
			</view>
		</xzfx-panel>
		<view v-if="form && e.my == 0" class="submit-button" @click.stop="$call(form.contackPhone)">立即联系</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				e: null,
				form: null
			};
		},
		onLoad(e){
			this.e = e;
			this.$utils.system.loading("加载中，请稍后");
			this.$apis.wantBuy.getDetails(e).then(res => {
				this.form = res;
			}).catch(err => {
				console.log(err)
			}).finally(() => {
				uni.hideLoading();
			});
		}
	}
</script>

<style scoped lang="scss">
	.page{
		padding-bottom: 50rpx;
	}
	.xzfx-form{
		padding-top: 20rpx;
		.xzfx-form-item{
			width: 100%;
			height: 90rpx;
			display: flex;
			align-items: center;
			border-top: 1rpx solid #f1f1f1;
			.xzfx-form-label{
				position: relative;
				width: 220rpx;
				padding-left: 18rpx;
				font-size: 30rpx;
				color: #333333;
			}
			.required::before{
				position: absolute;
				left: 0;
				content: "*";
				color: red;
			}
			.xzfx-form-value{
				width: calc(100% - 220rpx);
				text-align: right;
			}
		}
		.xzfx-form-item:first-child{
			border-top: none;
		}
	}
	.submit-button {
		margin: 60rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 90rpx;
		border-radius: 46rpx;
		background: $xzfx-theme;
		color: #FFFFFF;
		font-size: 32rpx;
		padding: 0 40rpx;
		overflow: hidden;
	}
</style>
